<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;padding: 0;
        }
        .box1{
            width: 300px;height: 300px;position: relative;left: 500px;top: 100px;
            border: 1px solid black;background: #ccc;
        }
        .box2{
            position: absolute;left: 0;top: 0;right: 0;bottom: 0;background: burlywood;
        }
    </style>
</head>
<body>
    <div class="box1">
        <em class="box2"></em>
    </div>
</body>
<script>
    const box2=document.querySelector(".box2");
    box2.onmouseenter=function(){
        console.log("已进入box2")
    }
</script>
</html>